﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:common="clr-namespace:Brjnk.Common;assembly=Common"
                    xmlns:coordSys="clr-namespace:Brjnk.CoordinateSystem2D;assembly=CoordinateSystem2D"
                    xmlns:layers="clr-namespace:Brjnk.CoordinateSystem2D.Layers;assembly=CoordinateSystem2D"
                    xmlns:local="clr-namespace:Brjnk.GpxExplorer"
                    xmlns:searching="clr-namespace:Brjnk.GpxExplorer.Workspace.Searching"
                    xmlns:ui="clr-namespace:Brjnk.Common.UI;assembly=Common"
                    xmlns:vm="clr-namespace:Brjnk.GpxExplorer.ViewModel"
                    xmlns:workspace="clr-namespace:Brjnk.GpxExplorer.Workspace">

    <coordSys:Area2D x:Key="Area2D" />

    <!--  Vrstva tras  -->
    <layers:GraphLayer x:Key="RoutesLayer" GraphInfoTemplate="{StaticResource AreaPopupRouteTemplate}"
                       GraphMenuTemplate="{StaticResource AreaRouteMenuTemplate}" />

    <!--  Vrstva stop  -->
    <layers:GraphLayer x:Key="TracksLayer" GraphInfoTemplate="{StaticResource AreaPopupTrackTemplate}"
                       GraphMenuTemplate="{StaticResource AreaTrackMenuTemplate}" />

    <!--  Vrstva bodů nebo SearchResult, který má SearchedItem=WaypointVM  -->
    <layers:PointsLayer x:Key="PointsLayer">
        <layers:PointsLayer.PointInfoTemplateSelector>
            <common:GenericTemplateSelector>
                <common:TemplateDefinition ObjectType="{x:Type vm:WaypointVM}" Template="{StaticResource AreaPopupWaypointTemplate}" />
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchResult}" Template="{StaticResource AreaPopupWaypointResultTemplate}" />
            </common:GenericTemplateSelector>
        </layers:PointsLayer.PointInfoTemplateSelector>

        <layers:PointsLayer.PointTemplateSelector>
            <common:GenericTemplateSelector>
                <common:TemplateDefinition ObjectType="{x:Type vm:WaypointVM}" Template="{StaticResource AreaWaypointTemplate}" />
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchResult}" Template="{StaticResource AreaWaypointResultTemplate}" />
            </common:GenericTemplateSelector>
        </layers:PointsLayer.PointTemplateSelector>
        <layers:PointsLayer.PointContextMenuTemplateSelector>
            <common:GenericTemplateSelector>
                <common:TemplateDefinition ObjectType="{x:Type vm:WaypointVM}" Template="{StaticResource AreaWaypointMenuTemplate}" />


                <common:TemplateDefinition ObjectType="{x:Type searching:SearchResult}">
                    <DataTemplate>
                        <ContentControl Content="{Binding SearchedItem}" ContentTemplate="{StaticResource AreaWaypointMenuTemplate}" />            
                    </DataTemplate>
                </common:TemplateDefinition>
            </common:GenericTemplateSelector>
        </layers:PointsLayer.PointContextMenuTemplateSelector>
    </layers:PointsLayer>

    <!--  Vrstva fotografií  -->
    <layers:PhotosLayer x:Key="PhotosLayer" />

    <!--  Vrstva bodů trasy  -->
    <layers:PointsLayer x:Key="RoutePointsLayer" PointTemplate="{StaticResource AreaRoutePointTemplate}" />

    <!--  Vrstva bodů stopy  -->
    <layers:PointsLayer x:Key="TrackPointsLayer" PointTemplate="{StaticResource AreaTrackPointTemplate}" />

    <!--  Vrstva výsledků vyhledávání nebo SearchRequests  -->
    <layers:PointsLayer x:Key="SearchResultsLayer">
        <layers:PointsLayer.PointInfoTemplateSelector>
            <common:GenericTemplateSelector>
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchRequest}" Template="{StaticResource AreaPopupSearchRequestTemplate}" />
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchResult}" Template="{StaticResource AreaPopupSearchResultTemplate}" />
            </common:GenericTemplateSelector>
        </layers:PointsLayer.PointInfoTemplateSelector>
        <layers:PointsLayer.PointContextMenuTemplateSelector>
            <common:GenericTemplateSelector>
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchRequest}" Template="{StaticResource AreaSearchRequestMenuTemplate}" />
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchResult}" Template="{StaticResource AreaSearchResultMenuTemplate}" />
            </common:GenericTemplateSelector>
        </layers:PointsLayer.PointContextMenuTemplateSelector>
        <layers:PointsLayer.PointTemplateSelector>
            <common:GenericTemplateSelector>
                <common:TemplateDefinition ObjectType="{x:Type searching:Pushpin}" Template="{StaticResource AreaPushpinTemplate}" />
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchRequest}" Template="{StaticResource AreaSearchRequestTemplate}" />
                <common:TemplateDefinition ObjectType="{x:Type searching:SearchResult}" Template="{StaticResource AreaSearchResultTemplate}" />
            </common:GenericTemplateSelector>
        </layers:PointsLayer.PointTemplateSelector>
    </layers:PointsLayer>

    <!--  Mřížka  -->
    <layers:Grid x:Key="GridLayer" />

    <!--  Mapa  -->
    <local:MapLayer x:Key="MapLayer" />
</ResourceDictionary>